/**
 * 
 */
package com.ez.supervise.service.impl;

import java.util.List;

import com.ez.supervise.core.Page;
import com.ez.supervise.dao.MessageDao;
import com.ez.supervise.model.biz.Message;
import com.ez.supervise.service.MessageService;

/**
 * @author searph.wang
 * @email searph.wang@gmail.com
 * @Created at 2009-7-22
 * 
 */
public class MessageServiceImpl implements MessageService {
    private MessageDao messageDao;

    // public int update(Message org) {
    // return sqlMapClientTemplate.update("sys.updateMessage", org);
    // }

    public void setMessageDao(MessageDao messageDao) {
	this.messageDao = messageDao;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#delete(java.lang.Long)
     */
    public void delete(Long id) {
	messageDao.delete(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#insert(java.lang.Object)
     */
    public void insert(Object entity) {
	messageDao.insert(entity);

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#update(java.lang.Object)
     */
    public void update(Object entity) {
	messageDao.update(entity);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#get(java.lang.Long)
     */
    public Object get(Long id) {
	return (Message) messageDao.get(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.ez.supervise.service.MessageService#findByPage(com.ez.supervise.core.
     * Page)
     */
    public Page findByPage(Page page) {
	page.setRoot(messageDao.findByPage(page));
	page.setTotalProperty(messageDao.findByCount(page));
	return page;

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.MessageService#findAll()
     */
    public List findAll() {
	return messageDao.findAll();
    }

    public List findRootMessage() {
	return messageDao.findRootMessage();
    }
}
